import { request } from '@/utils/service'

/**
 * 获取订单列表
 * @param {Object} params - 查询参数，包含状态、页码等
 * @returns {Promise} - 返回订单列表数据
 */
export const getOrderList = data => request({ url: 'order/list', method: 'post', data })

/**
 * 获取订单详情
 * @param {string} id - 订单ID
 * @returns {Promise} - 返回订单详情数据
 */
export const getOrderDetail = data => request({ url: 'order/info', method: 'post', data })

/**
 * 更新订单状态
 * @param {Object} data - 包含订单ID和新状态
 * @returns {Promise} - 返回更新结果
 */
export const cancelOrder = order_bn => request({ url: 'order/cancel', method: 'post', data: { order_bn } })

export const payOrder = (order_bn, payment_code = 'lianlpay_offline') => request({ url: 'order/toPay', method: 'post', data: { order_bn, payment_code } })

/**
 * 检查订单支付状态
 * @param {string} order_bn - 订单编号
 * @returns {Promise} - 返回支付状态
 */
export const checkOrderPay = pay_no => request({ url: 'order/checkOrderPay', method: 'post', data: { pay_no } })
